package com.small.sentinel.slots.flow;

import com.small.sentinel.slots.block.AbstractRule;
import com.small.sentinel.slots.block.RuleConstant;
import com.small.sentinel.slots.flow.controller.TrafficShapingController;

public class FlowRule extends AbstractRule {

    /**
     * 流控制的阈值类型（0:线程计数，1:QPS）。
     */
    private int grade = RuleConstant.FLOW_GRADE_QPS;

    /**
     * 流量控制阈值计数
     */
    private double count;

    /**
     * 流控模式
     */
    private int strategy = RuleConstant.STRATEGY_DIRECT;

    /**
     * 相关资源
     */
    private String refResource;

    /**
     * 控制器
     */
    private TrafficShapingController controller;

    public int getStrategy() {
        return strategy;
    }

    public String getRefResource() {
        return refResource;
    }


    FlowRule setRater(TrafficShapingController rater) {
        this.controller = rater;
        return this;
    }

    TrafficShapingController getRater() {
        return controller;
    }
}
